/*
 * (C) 2012	Sheng Yi
 * Read a symbol link file, print the actual file name that 
 * it links to
 */
#include "apue.h"

#define	THISSIZE	1024

int main(int argc, char *argv[])
{
	char buf[THISSIZE];
	ssize_t n;
	if (argc != 2)
		err_quit("usage: a.out sympath");

	if ((n = readlink(argv[1], buf, THISSIZE)) < 0)
		err_quit("readlink error");

	buf[n] = '\0';

	printf("%s ----> %s\n", argv[1], buf);
	return 0;
}
